package com.yanfan.alarm.service.impl;

import java.util.Arrays;
import java.util.List;
import com.yanfan.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanfan.alarm.mapper.NjAlarmDeviceInfoMapper;
import com.yanfan.alarm.domain.NjAlarmDeviceInfo;
import com.yanfan.alarm.service.INjAlarmDeviceInfoService;

/**
 * 报警主机状态Service业务层处理
 *
 * @author genluo
 * @date 2024-10-31
 */
@Service
public class NjAlarmDeviceInfoServiceImpl extends ServiceImpl<NjAlarmDeviceInfoMapper, NjAlarmDeviceInfo> implements INjAlarmDeviceInfoService {
    @Autowired
    private NjAlarmDeviceInfoMapper njAlarmDeviceInfoMapper;


    /**
     * 查询报警主机状态列表
     *
     * @param njAlarmDeviceInfo 报警主机状态
     * @return 报警主机状态
     */
    @Override
    public List<NjAlarmDeviceInfo> queryPageList(NjAlarmDeviceInfo njAlarmDeviceInfo) {
        LambdaQueryWrapper<NjAlarmDeviceInfo> lqw = buildQueryWrapper(njAlarmDeviceInfo);
        return njAlarmDeviceInfoMapper.selectList(lqw);
        //连表查询可用该方法，在此方法SQL语句上进行扩展
        //return njAlarmDeviceInfoMapper.queryPageList(njAlarmDeviceInfo);
    }

    /**
    * 分页查询条件
    * @return
    */
    private LambdaQueryWrapper<NjAlarmDeviceInfo> buildQueryWrapper(NjAlarmDeviceInfo bo) {
        LambdaQueryWrapper<NjAlarmDeviceInfo> lqw = Wrappers.lambdaQuery();
        lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), NjAlarmDeviceInfo::getDeviceName, bo.getDeviceName());
        return lqw;
    }



}
